$(function(){
	if(getCookieValue("token")==""){
		window.location.href = 'l-userlogin.html'
	}
	
	
	heardLook(function(data){	
		var userServe = data.user.userServe;
		$('.txt').val(userServe);
	});
	
	$('.btn').click(function(){
		var areaTxt = $('.txt').val();
		console.log(areaTxt,789);
		personRevise({
		userServe:areaTxt,
		token:getCookieValue("token")
	},function(data){
		mui.toast('修改成功！')
	})
	});
	
	
	
});

//个人信息
var heardLook = function(callback) {
	$.ajax({
		type: "post",
		cache: false,
		traditional: true,
		dataType: "json",
		url: window.address + "/user/findBayUserUuid",
		xhrFields: {
			withCredentials: true
		},
		crossDomain: true,
		data: {
			"userUuid":CD.geturl().business
		},
		success: function(data) {
			//console.log(data);
			callback && callback(data);
		}
	});
}

//修改
var personRevise = function(params, callback) {
	$.ajax({
		type: "get",
		url: window.address + "/user/userUpdate",
		xhrFields: {
			withCredentials: true
		},
		crossDomain: true,
		data: params,
		dataType: "json",
		success: function(data) {
			//console.log(data, 11111)
			callback && callback(data);
		}
	});
};